package com.tianze.tzkf.base;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

public class ViewPagerAdapter extends FragmentPagerAdapter {

    List<String> type;
    List<Fragment> fragments;
    public ViewPagerAdapter(FragmentManager fm, List<String> type, List<Fragment> fragments) {
        super(fm);
        this.type = type;
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {

        return fragments.get(position);
//        return null;
    }

    @Override
    public int getCount() {

        return type == null ? 0 : type.size();

    }

    @Override
    public CharSequence getPageTitle(int position) {
        return type.get(position);
    }

}
